﻿@model NerdDinnerMVC.NerdDinnerService.DinnerDTO

<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Map.js")" type="text/javascript"></script>

<div id="theMap" style="position:relative; width:500px; height:400px;"></div>
<script type="text/javascript">

   


    function onReady() {
        var latitude = @Model.Latitude;
        var longitude = @Model.Longitude;
                
        if ((latitude == 0) || (longitude == 0))
            LoadMap();
        else
            LoadMap(latitude, longitude, mapLoaded);
    }
      
    function mapLoaded() {
        var title = "@Model.Title";
        var address = "@Model.Address";
    
        LoadPin(map.GetCenter(), title, address);
        map.SetZoomLevel(14);
    } 
    
    
    $(document).ready(onReady);
</script>